package com.tinygray.productConsumer;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author: tinygray
 * @Description: 公众号:Madison龙少，关注我你会越来越优秀。
 * @className: productConsumer_BlockQueueDemo
 * @create: 2021-05-09 17:10
 */
public class productConsumer_BlockQueueDemo {
    public static void main(String[] args) {

    }
}

class MyResource {
    private volatile boolean FLAG = true;//默认开启进行生产和消费
    private AtomicInteger atomicInteger = new AtomicInteger();
    /**
     * 写代码：写的时候要足够的抽象  往高处写，
     *  检查：足够的落地 往细节落地
     */
    BlockingQueue<String> blockingQueue = null;//传接口 让别人实现  从而实现通用性

    public MyResource(BlockingQueue<String> blockingQueue) {
        this.blockingQueue = blockingQueue;
    }
    public void  myProduct(){

    }

}
class SingletonDemo {
    private static volatile SingletonDemo singletonDemo = null;

    public static SingletonDemo getSingletonDemo() {
        if (singletonDemo == null) {
            synchronized (SingletonDemo.class) {
                if(singletonDemo==null){
                    singletonDemo = new SingletonDemo();
                }
            }
        }
        return singletonDemo;
    }
}